package com.qf.sale.service.impl;

import com.github.pagehelper.PageHelper;
import com.qf.lw.mapper.GoodsMapper;
import com.qf.lw.mapper.GoodsTypeMapper;
import com.qf.lw.pojo.GoodsPojo;
import com.qf.lw.pojo.GoodsTypePojo;
import com.qf.sale.service.IIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class IndexServiceImpl implements IIndexService {
    @Autowired
    GoodsTypeMapper goodsTypeMapper;

    @Autowired
    GoodsMapper goodsMapper;

    @Override
       public List<GoodsTypePojo> queryGoodsTypes() {

        List<GoodsTypePojo> goodsTypePojos = goodsTypeMapper.queryGoodsTypeThree();
        return  goodsTypePojos;
    }

    /**
     * 查询6个商品
     * @return
     */
    @Override
    public List<GoodsPojo> queryGoods() {

        PageHelper.startPage(1,6); //实现只查询6个
        List<GoodsPojo> list = goodsMapper.queryGoodsByPojo(null);
        return list;
    }
}
